//
//  PhoneViewController.m
//  RainbowFM
//
//  Created by chenli on 14/12/10.
//  Copyright (c) 2014年 RB. All rights reserved.
//

#import "PhoneViewController.h"
#import "LoginModel.h"
#import "VerifyViewController.h"
#import <SVProgressHUD.h>

@interface PhoneViewController ()
@property (weak, nonatomic) IBOutlet UITextField *phoneNumField;

@end

@implementation PhoneViewController

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    self.navigationController.navigationBarHidden = NO;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
- (IBAction)nextAction:(id)sender {
    [SVProgressHUD show];
    [[LoginModel sharedModel] fetchSecurityCodeWithPhoneNum:_phoneNumField.text result:^(BOOL success, NSString *msg) {
        if (success) {
            [SVProgressHUD dismiss];
            VerifyViewController *verifyView = [self.storyboard instantiateViewControllerWithIdentifier:@"VerifyViewController"];
            verifyView.phoneNum = _phoneNumField.text;
            [self.navigationController pushViewController:verifyView animated:YES];
        }else{
            [SVProgressHUD showErrorWithStatus:msg];
        }
    }];
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
